]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-bin: Delegate popup-menu signal to child if we have one
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 7 May 2013 06:28:13 +0000 (02:28 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 7 May 2013 09:14:58 +0000 (05:14 -0400)
This makes it much easier to implement correct popup-menu behavior
in the case of nested bins.

This fixes the context menu key in application search results when a
result has focus.

https://bugzilla.gnome.org/show_bug.cgi?id=699800

src/st/st-bin.c
src/st/st-widget.c
src/st/st-widget.h

index 0a45148ee57d78f72195c195ab2a4ba9632c89d1..6a3cf0860ea9f0954c67d6b9b534a0d23f4890f9 100644 (file)
@@ -187,6 +187,15 @@ st_bin_dispose (GObject *gobject)
   G_OBJECT_CLASS (st_bin_parent_class)->dispose (gobject);
 }
 
+static void
+st_bin_popup_menu (StWidget *widget)
+{
+  StBinPrivate *priv = ST_BIN (widget)->priv;
+
+  if (priv->child && ST_IS_WIDGET (priv->child))
+    st_widget_popup_menu (ST_WIDGET (priv->child));
+}
+
 static gboolean
 st_bin_navigate_focus (StWidget         *widget,
                        ClutterActor     *from,
@@ -312,6 +321,7 @@ st_bin_class_init (StBinClass *klass)
   actor_class->get_preferred_height = st_bin_get_preferred_height;
   actor_class->allocate = st_bin_allocate;
 
+  widget_class->popup_menu = st_bin_popup_menu;
   widget_class->navigate_focus = st_bin_navigate_focus;
 
   /**
index c07dd7b4f1abdd9f819eb41626db394497ed5b01..91db0c3d29d745de714fd7ff5a0102c3fbbfd97d 100644 (file)
@@ -775,7 +775,7 @@ st_widget_key_press_event (ClutterActor    *actor,
       (event->keyval == CLUTTER_KEY_F10 &&
        (event->modifier_state & CLUTTER_SHIFT_MASK)))
     {
-      g_signal_emit (actor, signals[POPUP_MENU], 0);
+      st_widget_popup_menu (ST_WIDGET (actor));
       return TRUE;
     }
 
@@ -1834,6 +1834,18 @@ st_widget_get_can_focus (StWidget *widget)
   return widget->priv->can_focus;
 }
 
+/**
+ * st_widget_popup_menu:
+ * @self: A #StWidget
+ *
+ * Asks the widget to pop-up a context menu.
+ */
+void
+st_widget_popup_menu (StWidget *self)
+{
+  g_signal_emit (self, signals[POPUP_MENU], 0);
+}
+
 /* filter @children to contain only only actors that overlap @rbox
  * when moving in @direction. (Assuming no transformations.)
  */
index eb9e4cec188ef22a64a767408e842a488ac6851b..4b600b46a4c4740471f7f8775e31f395d2d8d340 100644 (file)
@@ -127,6 +127,7 @@ void                  st_widget_set_hover                 (StWidget        *widg
                                                            gboolean         hover);
 void                  st_widget_sync_hover                (StWidget        *widget);
 gboolean              st_widget_get_hover                 (StWidget        *widget);
+void                  st_widget_popup_menu                (StWidget        *self);
 
 void                  st_widget_ensure_style              (StWidget        *widget);